<?php

namespace app\modules\admin\controllers;

use app\common\controllers\AccessController;
use app\modules\admin\forms\merchant\MerchantPaymentForm;
use app\modules\admin\services\MerchantPaymentService;
use yii\base\UserException;

class MerchantPaymentController extends AccessController{

    //获取信息
    public function actionGetInfoById($id){
        return MerchantPaymentService::getInfoById($id);
    }

    //编辑
    public function actionEdit(){
        $form = new MerchantPaymentForm();
        if($form->load(\Yii::$app->getRequest()->post(),'') && MerchantPaymentService::update($form)){
            return "";
        }else{
            throw new UserException(MerchantPaymentService::getError());
        }
    }

    //删除
    public function actionDelete($id){
        MerchantPaymentService::delete($id);
        return "";
    }
}